//
//  HWGameDetailOpenServiceHeader.swift
//  HWanGame
//
//  Created by 王昌健 on 2022/3/25.
//  Copyright © 2022 94Wan. All rights reserved.
//

import UIKit

class HWGameDetailOpenServiceHeader: UITableViewHeaderFooterView {
    var titleLabel:UILabel!
    class func headerOrFooterWithTableView(tableView:UITableView) -> (HWGameDetailOpenServiceHeader) {
        let reUse:String = "HWGameDetailOpenServiceHeader"
        
        var headerOrFooter = tableView.dequeueReusableHeaderFooterView(withIdentifier: reUse)
        
        if headerOrFooter == nil {
            headerOrFooter = HWGameDetailOpenServiceHeader.init(reuseIdentifier: reUse)
        }
        
        return headerOrFooter as! HWGameDetailOpenServiceHeader
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier)
        initUI()
        initFrame()
    }
    
    
    func initUI() -> Void {
        
        backgroundView = UIView()
        backgroundColor = UIColor.white
        contentView.backgroundColor = .white
        
        titleLabel = HWLabel.createLabel(title: "仅供参考，以游戏内开服为准", color: "#888888", font: 10*widthScale)
        titleLabel.backgroundColor = .colorWithHexString(hexString: "#EBEBED")
        titleLabel.layer.cornerRadius = 9*widthScale
        titleLabel.layer.masksToBounds = true
        titleLabel.textAlignment = .center
        contentView.addSubview(titleLabel)
        
    }
    
    func initFrame() -> Void {
        titleLabel.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.left.equalTo(48*widthScale)
            make.right.equalTo(-48*widthScale)
            make.height.equalTo(18*widthScale)
        }
    }
}
